home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / HandHeldPCPro30 / sdk.exe / Jupiter SDK / data1.cab / MFC_Samples / banner / banner.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1999-02-19  |  3.5 KB  |  142 lines

  1. // Banner.cpp : Defines the class behaviors for the application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "Banner.h"
  6.  
  7. #include "MainFrm.h"
  8. #include "BannDoc.h"
  9. #include "BannView.h"
  10.  
  11. #ifdef _DEBUG
  12. #define new DEBUG_NEW
  13. #undef THIS_FILE
  14. static char THIS_FILE[] = __FILE__;
  15. #endif
  16.  
  17. /////////////////////////////////////////////////////////////////////////////
  18. // CBannerApp
  19.  
  20. BEGIN_MESSAGE_MAP(CBannerApp, CWinApp)
  21.     //{{AFX_MSG_MAP(CBannerApp)
  22.     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  23.         // NOTE - the ClassWizard will add and remove mapping macros here.
  24.         //    DO NOT EDIT what you see in these blocks of generated code!
  25.     //}}AFX_MSG_MAP
  26.     // Standard file based document commands
  27. END_MESSAGE_MAP()
  28.  
  29. /////////////////////////////////////////////////////////////////////////////
  30. // CBannerApp construction
  31.  
  32. CBannerApp::CBannerApp(LPCTSTR lpszAppName)
  33.     : CWinApp(lpszAppName)
  34. {
  35. }
  36.  
  37. /////////////////////////////////////////////////////////////////////////////
  38. // The one and only CBannerApp object
  39.  
  40. // WCE MFC apps require the application name to be specified in the CWinApp 
  41. // constructor. A help contents filename may also be specified.
  42.  
  43. CBannerApp theApp(_T("Banner"));
  44.  
  45. /////////////////////////////////////////////////////////////////////////////
  46. // CBannerApp initialization
  47.  
  48.  
  49. BOOL CBannerApp::InitInstance()
  50. {
  51.     LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  52.     
  53.     CSingleDocTemplate* pDocTemplate;
  54.     pDocTemplate = new CSingleDocTemplate(
  55.         IDR_MAINFRAME,
  56.         RUNTIME_CLASS(CBannerDoc),
  57.         RUNTIME_CLASS(CMainFrame),       // main SDI frame window
  58.         RUNTIME_CLASS(CBannerView));
  59.  
  60.  
  61.     AddDocTemplate(pDocTemplate);
  62.  
  63.     // Parse command line for standard shell commands, DDE, file open
  64.     CCommandLineInfo cmdInfo;
  65.     ParseCommandLine(cmdInfo);
  66.  
  67.     // Dispatch commands specified on the command line
  68.     if (!ProcessShellCommand(cmdInfo))
  69.         return FALSE;
  70.  
  71.     // The one and only window has been initialized, so show and update it.
  72.     m_pMainWnd->ShowWindow(SW_SHOW);
  73.     m_pMainWnd->UpdateWindow();
  74.  
  75.     return TRUE;
  76. }
  77.  
  78. /////////////////////////////////////////////////////////////////////////////
  79. // CAboutDlg dialog used for App About
  80.  
  81. class CAboutDlg : public CDialog
  82. {
  83. public:
  84.     CAboutDlg();
  85.  
  86. // Dialog Data
  87.     //{{AFX_DATA(CAboutDlg)
  88.     enum { IDD = IDD_ABOUTBOX };
  89.     //}}AFX_DATA
  90.  
  91.     // ClassWizard generated virtual function overrides
  92.     //{{AFX_VIRTUAL(CAboutDlg)
  93.     protected:
  94.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  95.     //}}AFX_VIRTUAL
  96.  
  97. // Implementation
  98. protected:
  99.     //{{AFX_MSG(CAboutDlg)
  100.     virtual BOOL OnInitDialog();        // Added for WCE apps
  101.     //}}AFX_MSG
  102.     DECLARE_MESSAGE_MAP()
  103. };
  104.  
  105. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  106. {
  107.     //{{AFX_DATA_INIT(CAboutDlg)
  108.     //}}AFX_DATA_INIT
  109. }
  110.  
  111. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  112. {
  113.     CDialog::DoDataExchange(pDX);
  114.     //{{AFX_DATA_MAP(CAboutDlg)
  115.     //}}AFX_DATA_MAP
  116. }
  117.  
  118. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  119.     //{{AFX_MSG_MAP(CAboutDlg)
  120.         // No message handlers
  121.     //}}AFX_MSG_MAP
  122. END_MESSAGE_MAP()
  123.  
  124. // App command to run the dialog
  125. void CBannerApp::OnAppAbout()
  126. {
  127.     CAboutDlg aboutDlg;
  128.     aboutDlg.DoModal();
  129. }
  130.  
  131. /////////////////////////////////////////////////////////////////////////////
  132. // CBannerApp commands
  133. // Added for WCE apps
  134.  
  135. BOOL CAboutDlg::OnInitDialog() 
  136. {
  137.     CDialog::OnInitDialog();
  138.     CenterWindow();    
  139.     return TRUE;  // return TRUE unless you set the focus to a control
  140.                   // EXCEPTION: OCX Property Pages should return FALSE
  141. }
  142.